import org.testng.Assert;
import org.testng.annotations.Test;

import static org.testng.Assert.*;

public class ShapeAreaCalculatorTest {

    @Test
    public void testSquareArea() {

        Assert.assertEquals(ShapeAreaCalculator.squareArea(5), 25.0, " 正⽅形⾯积计算错误。");
    }

    @Test
    public void testCircleArea() {
        //梯形上底 2，下底 3，⾼4，⾯积应为 10.0。容许的误差为 0.001 Assert.assertEquals(ShapeAreaCalculator.trapezoidArea(2, 3, 4), 10.0, 0.001, " 梯形⾯积计算错误。");
    }

    @Test
    public void testTriangleArea() {
        Assert.assertEquals(ShapeAreaCalculator.circleArea(1), Math.PI, 0.001," 圆形⾯积计算错误。");
    }

    @Test
    public void testTrapezoidArea() {
        Assert.assertEquals(ShapeAreaCalculator.triangleArea(3, 4, 5), 6.0,0.001, " 三⻆形⾯积计算错误。");
    }
}